#ifndef LEARN_VULKAN_VKHELPER_H
#define LEARN_VULKAN_VKHELPER_H

#include "VulkanCommon.h"
#include "VkBundle.h"

class VkHelper {
public:
    static void createInstance(bool bValidate, VkInstance *out_instance, VkDebugReportCallbackEXT *out_debugReport);
    static void pickPhyDevAndCreateDev(VkInstance instance, VkSurfaceKHR surface, DeviceInfo *out_deviceInfo, QueueInfo *out_queueInfo);
    static void createCommandPool(VkDevice device, uint32_t workQueueIndex, VkCommandPool *out_cmdPool);
    static void createSwapchain(VkPhysicalDevice physicalDev, VkDevice device, VkSurfaceKHR surface, uint16_t workQueueIndex, uint16_t presentQueueIndex,
                                SwapchainParam *out_swapchainParam, VkSwapchainKHR *out_swapchain);
    static void createRenderPass(VkDevice device, SwapchainParam swapchainParam, VkRenderPass *out_renderPass);
    static void createFramebuffer(VkDevice device, VkRenderPass renderPass, uint32_t width, uint32_t height,
                                     uint32_t framebufferCount, VkImageView *imageViews, VkFramebuffer *out_framebuffers);
    static void createPipelineLayout(VkDevice device, VkPipelineLayout *out_pipelineLayout);
    static VkShaderModule createShaderModule(VkDevice device, std::vector<char> &code);
    static void createPipeline(VkDevice device, VkPipelineLayout pipelineLayout, VkRenderPass renderPass,
                                  VkShaderModule vertShaderModule, VkShaderModule fragShaderModule, SwapchainParam swapchainParam,
                                  VkPipeline *out_pipeline);
    static void allocateCommandBuffers(VkDevice device, VkCommandPool cmdPool, uint32_t cmdBufferCount, VkCommandBuffer *cmdBuffers);
    static void printPhysicalDevLog(const VkPhysicalDeviceProperties &devProps);
};

#endif //LEARN_VULKAN_VKHELPER_H
